package com.asset.crm.dao;
//package com.asset.salesforce.dao;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.hibernate.Query;
//import org.hibernate.Session;
//import org.hibernate.SessionFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//
//import com.asset.salesforce.domain.LeadSource;
//
//@Repository
//public class LeadSourceDaoImpl {
//
//	@Autowired
//	SessionFactory sessionFactory;
//	
//	@SuppressWarnings("unchecked")
//	public LeadSource getLeadSourceById(Integer id) {
//		 Session session = sessionFactory.getCurrentSession();
//		 Query query = session.createQuery("from LeadSource where id=  :id");
//		 query.setParameter("id", id);
//		 List<LeadSource>list  = new ArrayList<LeadSource>();
//		 list  =   query.list();
//		if(list.size() >0){
//			return list.get(0);
//		}else{
//			return new LeadSource();
//		}
//		 
//	
//	}
//	
//	@SuppressWarnings("unchecked")
//	public List<LeadSource> getAllLeadSourceById() {
//		 Session session = sessionFactory.getCurrentSession();
//		 Query query = session.createQuery("from LeadSource");
//		List<LeadSource>list =   query.list();
//		 
//		return list;
//	}
//	
//	@SuppressWarnings("unchecked")
//	public LeadSource getLeadSourceByName(String name) {
//		 Session session = sessionFactory.getCurrentSession();
//		 Query query = session.createQuery("from LeadSource where name=  :name");
//		 query.setParameter("name", name);
//		 List<LeadSource>list  = new ArrayList<LeadSource>();
//		 list  =   query.list();
//		if(list.size() >0){
//			return list.get(0);
//		}else{
//			return new LeadSource();
//		}
//		 
//	
//	}
//	
//}
